package com.mvc.mapper;

import com.mvc.pojo.Department;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface DepartmentMapper {

    @Results(id = "deptMap",value = {
            @Result(property = "id",column = "id",id = true),
            @Result(property = "name",column = "name"),
            @Result(property = "employees",column = "id",
                    many = @Many(select = "com.mvc.mapper.EmployeeMapper.selectByDeptId"))
    })
    @Select("select * from department where id = #{id}")
    Department selectById(Long id);
}
